use shuffle::shuffler::Shuffler;
use shuffle::irs::Irs;
use rand::rngs::mock::StepRng;

pub fn generate_list_i32(start: i32, end: i32) -> Vec<i32> {
    let mut rng = StepRng::new(2, 13);
    let mut irs = Irs::default();

    let range = start..end;
    let len = range.len();
    let mut list_i32 = Vec::with_capacity(len);
    for val in range {
        list_i32.push(val);
    } 

    match irs.shuffle(&mut list_i32, &mut rng) {
        Ok(_) => list_i32,
        Err(e) => {
            error!("generate_list_i32::irs.shuffle error: {e:?}");
            list_i32
        },
    }

    
}

#[cfg(test)]
mod tests {
    
    #[test]
    fn test_shuffle_generate_list_i32() {
        let mut list_i32 = super::generate_list_i32(1, 21);
        println!("shuffle: {list_i32:?}");
        list_i32.sort();
        println!("sorted: {list_i32:?}");
    }
}

